import request from '@/utils/request'
export const getRoleListAPI = (data) => {
  return request({
    url: 'v1/role',
    method: 'GET',
    params: data
  })
}
/**
 * 根据用户名查询
 * @param {*} data
 * @returns
 */
export const getRoleByNameAPI = (data) => {
  return request({
    url: 'v1/role',
    method: 'GET',
    params: data
  })
}
/**
 * 查询角色信息
 * @param {*} data
 * @returns
 */
export const searchRoleAPI = (id) => {
  return request({
    url: '/v1/role/' + id,
    method: 'get'
  })
}
/**
 * 新增角色
 * @param {*} data
 * @returns
 */
export const addRoleAPI = (data) => {
  return request({
    url: '/v1/role',
    method: 'POST',
    data: data
  })
}
/**
 * 新增角色
 * @param {*} data
 * @returns
 */
export const editRoleAPI = (data) => {
  return request({
    url: '/v1/role',
    method: 'PUT',
    data: data
  })
}
/**
 * 删除角色
 * @param {} id
 * @param {*} version
 * @returns
 */
export const DeleteRoleAPI = (id, version) => {
  return request({
    url: '/v1/role',
    method: 'DELETE',
    params: { id, version }
  })
}
// /v1/role/batch
/**
 *批量删除角色
 * @param {*} data
 * @returns
 */
export const deleteRoleBatchAPI = (data) => {
  return request({
    url: '/v1/role/batch',
    method: 'DELETE',
    data: data
  })
}
/**
 * 获取分配用户列表，也可做查找
 * @param {*} data
 * @returns
 */
export const getUserListAPI = (data) => {
  return request({
    url: '/v1/role/commonQueryUser',
    method: 'GET',
    params: data
  })
}
export const assignUserAPI = (data) => {
  debugger
  return request({
    url: '/v1/role/assignUser',
    method: 'POST',
    data: data
  })
}
